package main

import "fmt"

func main() {

	menu := []string{"Cake", "Pie"}
	fmt.Println("Initial Menu:", menu)
	fmt.Println("Length:", len(menu), "Capacity:", cap(menu))
	fmt.Printf("Memory location:%p\n", &menu)
	fmt.Printf("Memory location of \"cake\":%p\n", &menu[0])
	fmt.Println()

	menu = append(menu, "Donut")
	fmt.Println("Menu After adding donut:", menu)
	fmt.Println("Length:", len(menu), "Capacity:", cap(menu))
	fmt.Printf("Memory location:%p\n", &menu)
	fmt.Printf("Memory location of \"cake\":%p\n", &menu[0])
	fmt.Println()

	menu = append(menu, "Ice cream")
	fmt.Println("Menu After adding Ice cream:", menu)
	fmt.Println("Length:", len(menu), "Capacity:", cap(menu))
	fmt.Printf("Memory location:%p\n", &menu)
	fmt.Printf("Memory location of \"cake\":%p\n", &menu[0])
	fmt.Println()

	menu = append(menu, "Drink")
	fmt.Println("Menu After adding Drink:", menu)
	fmt.Println("Length:", len(menu), "Capacity:", cap(menu))
	fmt.Printf("Memory location:%p\n", &menu)
	fmt.Printf("Memory location of \"cake\":%p\n", &menu[0])
	fmt.Println()

	cupSizes := make([]string, 0, 5)
	fmt.Println("Len of cupSizes:", len(cupSizes), "Cap of cupSizes:", cap(cupSizes))
	// cupSizes[0] = "Small" //0长度的切片不能直接赋值，只能使用append函数

	cupSizes = append(cupSizes, "Small", "Medium")
	fmt.Println("Len of cupSizes:", len(cupSizes), "Cap of cupSizes:", cap(cupSizes))
	cupSizes[0] = "Extra Small"
	fmt.Println(cupSizes)
	fmt.Println("Len of cupSizes:", len(cupSizes), "Cap of cupSizes:", cap(cupSizes))

}
